﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PizzaWic.admin
{
    /// <summary>
    /// permet d'ajouter un raw_material avec ses caractéristiques
    /// </summary>
    public partial class AddRawMaterial : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {
            this.addRawMaterial();
            Response.Redirect("RawMaterialManagement.aspx");
        }


        protected void addMoreRM_Click(object sender, EventArgs e)
        {
            this.addRawMaterial();
            this.name.Text = "";
            this.quantity.Text = "";
            this.unitaryQuantity.Text = "";
            this.alertQuantity.Text = "";

        }

        private void addRawMaterial()
        {
            SqlAccess sqlAccess = new SqlAccess();
            Object[] data = new Object[5];
            data[0] = this.name.Text;
            data[1] = this.quantity.Text;
            data[2] = this.unitaryQuantity.Text;
            data[3] = this.alertQuantity.Text;
            data[4] = this.price.Text;
            sqlAccess.addRawMaterial(data);
        }
    }
}